package com.zlz.open.ugs.exchange.request;

import com.zlz.open.ugs.common.config.entity.runtime.UgsUrl;
import lombok.Getter;
import lombok.Setter;
import org.springframework.http.server.reactive.ServerHttpRequest;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: zhulinzhong
 * @Date: 2024/5/25
 */
@Getter
public class UgsRequest {

    private final ServerHttpRequest request;

    @Setter
    private UgsUrl url;

    private final Map<String, Map<String, Object>> params = new HashMap<>();

    @Setter
    private RequestBody body;


    UgsRequest(ServerHttpRequest request) {
        this.request = request;
    }

    public static class Builder {

        private ServerHttpRequest source;

        public Builder request(ServerHttpRequest request) {
            this.source = request;
            return this;
        }

        public UgsRequest build() {
            return new UgsRequest(source);
        }
    }

    enum TypeEnum {
        HEADER, BODY, PARAM
    }
}
